/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#ifndef OMEN_I_KERNEL_H
#define OMEN_I_KERNEL_H

#include "OmenConfig.h"

#include "IOmenGraphicsServer.h"
#include "IOmenStorageServer.h"
#include "IOmenInputServer.h"
#include "IOmenEventHandler.h"
#include "IOmenSceneManager.h"
#include "IOmenAssetManager.h"
#include "IOmenTimer.h"

#include "OmenProperty.h"
#include "OmenPropertyObject.h"

// STL headers
#include <string>

namespace Omen {

class OMEN_API IKernel : public Omen::IObject
{
    #define OMEN_DEFAULT_CONFIG_FILE std::wstring(L"config.cfg")

    #define GUID_OMEN_KERNEL "0B39041C-700B-4bdf-8DC5-C8D5E9EE4BBE"

public:
    virtual Omen_GUID classId() const { return OMEN_UUID(GUID_OMEN_KERNEL); }    /// <summary>Defines the class ID</summary>

    virtual Omen::IGraphicsServer* getGraphicsServer() = 0; /// <summary>Accesses the graphics server</summary>        
    virtual Omen::IStorageServer*  getStorageServer() = 0;  /// <summary>Accesses the storage server</summary>
    virtual Omen::IInputServer*    getInputServer() = 0;    /// <summary>Access the input server</summary>
    
    virtual Omen::ISceneManager*   getSceneManager() = 0;   /// <summary>Acces the scene manager</summary>
    virtual Omen::IAssetManager*   getAssetManager() = 0;   /// <summary>Access the asset manager</summary>

    virtual void loadPlugin(const std::wstring &filename) = 0;      /// <summary>Loads a plugin</summary>
    virtual void loadPlugins(const std::wstring &pluginPath) = 0;   /// <summary>Loads all plugins in a directory</summary>

    virtual bool initialize( const std::wstring& configFilePath = OMEN_DEFAULT_CONFIG_FILE) = 0;    /// <summary>Initialize the Engine using given config file. By default it's config.cfg</summary>
    virtual void run() = 0;
    virtual void shutDown() = 0;

    /// Event handling
    virtual void sendEvent( const Omen::Event* event ) = 0;
    virtual void registerEventHandler( Omen::IEventHandler* handler ) = 0;
    
    /// property functions for each of the types
    virtual Omen::Property& getProperty( std::wstring strPropertyName ) = 0;
    virtual void  setProperty( std::wstring strPropertyName, const std::wstring& property) = 0;

    /// property objects, containing several <std:wstring, std::wstring> key,value properties
    virtual bool addPropertyObject( Omen::PropertyObject& propertyObject ) = 0;
    virtual bool getPropertyObject( const std::wstring& strPropertyObjectName, Omen::PropertyObject& propertyObject ) = 0;

    /// Timer interface
    virtual Omen::ITimer* timer() = 0;      /// <summary>Returns the kernel timer</summary>
};

    

} // namespace Omen
#endif